home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Examples / Draw / Include / ToolFacet.h < prev    next >
Encoding:
Text File  |  1994-04-21  |  2.8 KB  |  96 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ToolFacet.h
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //    Creation Date:        3/28/94
  8. //
  9. //    Copyright:    © 1993, 1994 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //========================================================================================
  12.  
  13. #ifndef TOOLFACET_H
  14. #define TOOLFACET_H
  15.  
  16. #ifndef DRAWPART_H
  17. #include "DrawPart.h"
  18. #endif
  19.  
  20. // ----- Framework Includes -----
  21.  
  22. #ifndef FWFACET_H
  23. #include "FWFacet.h"
  24. #endif
  25.  
  26. // ----- Graphic Includes -----
  27.  
  28. #ifndef FWRECT_H
  29. #include "FWRect.h"
  30. #endif
  31.  
  32. #ifndef FWPAT_H
  33. #include "FWPat.h"
  34. #endif
  35.  
  36. //==============================================================================
  37. // Constants
  38. //==============================================================================
  39.  
  40. const short kNbRects = 9;
  41.  
  42. //==============================================================================
  43. // Forward Declaration
  44. //==============================================================================
  45.  
  46. class CDrawPart;
  47. class FW_CGraphicContext;
  48.  
  49. //==============================================================================
  50. // CToolFacet
  51. //==============================================================================
  52.  
  53. class CToolFacet : public FW_CFacet
  54. {
  55. //------------------------------------------------------------------------------
  56. // Initialization/destruction
  57. //------------------------------------------------------------------------------
  58. public:
  59.     CToolFacet();
  60.     void InitToolFacet(XMPFacet* facet, CDrawPart* drawPart);
  61.     virtual ~CToolFacet();
  62.  
  63. //------------------------------------------------------------------------------
  64. // Inherited
  65. //------------------------------------------------------------------------------
  66. public:    
  67.     virtual void             Draw(FW_CGraphicContext *gc);
  68.  
  69.     virtual FW_Boolean        DoMouseDown(const FW_CPoint& where,
  70.                                          XMPEventData event);
  71.     
  72. //------------------------------------------------------------------------------
  73. // New API
  74. //------------------------------------------------------------------------------
  75. public:
  76.     void                    CheckTool(unsigned short oldTool, 
  77.                                       unsigned short newTool);
  78.     void                    CheckFillFrame(unsigned short oldFillFrame, 
  79.                                              unsigned short newFillFrame);
  80.     void                    UpdateColors();
  81.     
  82. private:
  83.     short                TestRect(const FW_CPoint& pos, FW_CRect* rects, unsigned short nbRect);
  84.     void                    InvertTool(FW_CGraphicContext *gc, unsigned short theTool);
  85.     void                    DrawFillFrame(unsigned short fillFrame, const FW_CPattern& pattern);
  86.     void                    DrawTools(FW_CGraphicContext *gc);
  87.     void                    DrawColors(FW_CGraphicContext *gc);
  88.     
  89. //------------------------------------------------------------------------------
  90. // Data
  91. //------------------------------------------------------------------------------
  92. private:
  93.     CDrawPart*                fDrawPart;
  94.     FW_CRect                    fRects[kNbRects];
  95. };
  96. #endif